package ligacao;

import com.example.android.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ExemploFazLigacao extends Activity implements OnClickListener {
	
	Button button;
	EditText e;
	
	public void onCreate(Bundle b) {
		super.onCreate(b);
		setContentView(R.layout.form_fazligacao);
		e = (EditText) findViewById(R.id.campoNumero);
		button = (Button) findViewById(R.id.btligar);
		button.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		if(v == button) {
			Uri uri = Uri.parse("tel:"+e.getText().toString());
			Intent i = new Intent(Intent.ACTION_CALL,uri);
			startActivity(i);
		}
	}
}